#pragma once

/** reverse an array of integer
 *  @param arX the array that will be reversed
 *  @param count how many elements in the arX
 */
void reverse(int *arX, int count);

/** sorting array in ascent order
 *  @param arX the array that will be sorted
 *  @param count how many elements in the arX
 */
void sort_ascent(int *arX, int count);

/**
 * make a new array by deleting some elements
 * @param arSrc the source array
 * @param countSrc how many elements in the arSrc
 * @param arResult the result array
 * @param countResult how many elements in the arResult 
 */
void delete_elements_at_begin(short *arSrc, int countSrc, short *arResult, int countResult);

/** make a new array by deleting some elements at pos
 * @param arSrc the source array
 * @param countSrc how many elements in the arSrc
 * @param arResult the result array
 * @param countResult how many elements in the arResult
 * @param pos the position which begin to delete, 0 based(0 means drop from head)
 */
void delete_elements_at_pos(short *arSrc, int countSrc, short *arResult, int countResult, int pos);

/** combine 2 strings
 *  szLeft + szRight => szResult
 */
void combine_strings(char *szLeft, char *szRight, char *arResult);

/** find the pos of x in szSrc
 * @param szSrc the string to search
 * @param x the character to find
 * @return the index of the found charater, -1 if not found
 */
int find_pos(char *szSrc, char x);


/** Insert a string into another string
 * @param szResult buffer accepting the result
 * @param countResult how many elements can be hold in the szResult
 * @param szSrc the string that another string will be inserted into
 * @param pos the pos of szSrc to be inserted
 * @param szIns the string to be inserted
 */
void insert(char *szResult, int countResult, char *szSrc, int pos, char *szIns);